/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * InfoJPanel.java
 *
 * Created on 3.2.2010, 15:57:48
 */

package jmenu.gui;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import jmenu.main.Config;
import jmenu.main.MenuTabbedPane;

/**
 *
 * @author Boner
 */
public class InfoJPanel extends javax.swing.JPanel implements ChangeListener {

    private double [][] Data;

    private Color DarkGreen;

    /** Creates new form InfoJPanel */
    public InfoJPanel() {
        initComponents();


        this.DarkGreen = new Color(0, 128, 0, 255);

        this.Data = new double [2][5];

        for(int i = 0; i < 2;i++)
            for(int j = 0; j < 5;j++)
                this.Data[i][j] = 0.0;

        this.Recount();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        RecomendedLabel = new javax.swing.JLabel();
        ChPanel = new javax.swing.JPanel();
        ChLabel = new javax.swing.JLabel();
        ChRecomendedLabel1 = new jmenu.gui.ValueLabel();
        TPanel = new javax.swing.JPanel();
        TLabel = new javax.swing.JLabel();
        TRecomendedLabel = new jmenu.gui.ValueLabel();
        SPanel = new javax.swing.JPanel();
        SLabel = new javax.swing.JLabel();
        SRecomendedLabel = new jmenu.gui.ValueLabel();
        BPanel = new javax.swing.JPanel();
        BLabel = new javax.swing.JLabel();
        BRecomendedLabel = new jmenu.gui.ValueLabel();
        EnergyPanel = new javax.swing.JPanel();
        EnergyLabel = new javax.swing.JLabel();
        EnergyRecomendedLabel = new jmenu.gui.ValueLabel();
        jSeparator1 = new javax.swing.JSeparator();
        SummaryLabel = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        EnergyPanel1 = new javax.swing.JPanel();
        EnergyLabel1 = new javax.swing.JLabel();
        EnergySummaryLabel = new jmenu.gui.ValueLabel();
        BPanel1 = new javax.swing.JPanel();
        BLabel1 = new javax.swing.JLabel();
        BSummaryLabel = new jmenu.gui.ValueLabel();
        ChPanel1 = new javax.swing.JPanel();
        ChLabel1 = new javax.swing.JLabel();
        ChSummaryLabel = new jmenu.gui.ValueLabel();
        SPanel1 = new javax.swing.JPanel();
        SLabel1 = new javax.swing.JLabel();
        SSummaryLabel = new jmenu.gui.ValueLabel();
        TPanel1 = new javax.swing.JPanel();
        TLabel1 = new javax.swing.JLabel();
        TSummaryLabel = new jmenu.gui.ValueLabel();

        setBorder(javax.swing.BorderFactory.createTitledBorder("Info"));
        setMaximumSize(new java.awt.Dimension(392, 637));
        setMinimumSize(new java.awt.Dimension(392, 637));
        setPreferredSize(new java.awt.Dimension(392, 637));

        RecomendedLabel.setFont(new java.awt.Font("Tahoma", 1, 14));
        RecomendedLabel.setForeground(new java.awt.Color(153, 153, 153));
        RecomendedLabel.setText("Doporučené hodnoty celkem:");
        RecomendedLabel.setFocusable(false);
        RecomendedLabel.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        RecomendedLabel.setName("RecomendedLabel"); // NOI18N

        ChPanel.setMaximumSize(new java.awt.Dimension(78, 48));
        ChPanel.setMinimumSize(new java.awt.Dimension(78, 48));
        ChPanel.setName("ChPanel"); // NOI18N
        ChPanel.setPreferredSize(new java.awt.Dimension(78, 48));

        ChLabel.setText("Cholesterol:");
        ChLabel.setName("ChLabel"); // NOI18N

        ChRecomendedLabel1.setForeground(new java.awt.Color(153, 153, 153));
        ChRecomendedLabel1.setText("  -       ");
        ChRecomendedLabel1.setName("ChRecomendedLabel1"); // NOI18N

        javax.swing.GroupLayout ChPanelLayout = new javax.swing.GroupLayout(ChPanel);
        ChPanel.setLayout(ChPanelLayout);
        ChPanelLayout.setHorizontalGroup(
            ChPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ChPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ChLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addComponent(ChRecomendedLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
        );
        ChPanelLayout.setVerticalGroup(
            ChPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ChPanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(ChLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(ChRecomendedLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(146, 146, 146))
        );

        TPanel.setMaximumSize(new java.awt.Dimension(78, 48));
        TPanel.setMinimumSize(new java.awt.Dimension(78, 48));
        TPanel.setName("TPanel"); // NOI18N
        TPanel.setPreferredSize(new java.awt.Dimension(78, 48));

        TLabel.setText("Tuky:");
        TLabel.setName("TLabel"); // NOI18N

        TRecomendedLabel.setForeground(new java.awt.Color(153, 153, 153));
        TRecomendedLabel.setName("TRecomendedLabel"); // NOI18N

        javax.swing.GroupLayout TPanelLayout = new javax.swing.GroupLayout(TPanel);
        TPanel.setLayout(TPanelLayout);
        TPanelLayout.setHorizontalGroup(
            TPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, TPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(TRecomendedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(TLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE)
        );
        TPanelLayout.setVerticalGroup(
            TPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, TPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(TLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
                .addComponent(TRecomendedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        SPanel.setMaximumSize(new java.awt.Dimension(78, 48));
        SPanel.setMinimumSize(new java.awt.Dimension(78, 48));
        SPanel.setName("SPanel"); // NOI18N
        SPanel.setPreferredSize(new java.awt.Dimension(78, 48));

        SLabel.setText("Sacharidy:");
        SLabel.setName("SLabel"); // NOI18N

        SRecomendedLabel.setForeground(new java.awt.Color(153, 153, 153));
        SRecomendedLabel.setName("SRecomendedLabel"); // NOI18N

        javax.swing.GroupLayout SPanelLayout = new javax.swing.GroupLayout(SPanel);
        SPanel.setLayout(SPanelLayout);
        SPanelLayout.setHorizontalGroup(
            SPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, SPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(SRecomendedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(SLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
        );
        SPanelLayout.setVerticalGroup(
            SPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, SPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(SLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
                .addComponent(SRecomendedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        BPanel.setMaximumSize(new java.awt.Dimension(78, 48));
        BPanel.setMinimumSize(new java.awt.Dimension(78, 48));
        BPanel.setName("BPanel"); // NOI18N
        BPanel.setPreferredSize(new java.awt.Dimension(78, 48));

        BLabel.setText("Bílkoviny:");
        BLabel.setName("BLabel"); // NOI18N

        BRecomendedLabel.setForeground(new java.awt.Color(153, 153, 153));
        BRecomendedLabel.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        BRecomendedLabel.setName("BRecomendedLabel"); // NOI18N

        javax.swing.GroupLayout BPanelLayout = new javax.swing.GroupLayout(BPanel);
        BPanel.setLayout(BPanelLayout);
        BPanelLayout.setHorizontalGroup(
            BPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(BLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE)
            .addComponent(BRecomendedLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE)
        );
        BPanelLayout.setVerticalGroup(
            BPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, BPanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(BLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(BRecomendedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(146, 146, 146))
        );

        EnergyPanel.setMaximumSize(new java.awt.Dimension(78, 48));
        EnergyPanel.setMinimumSize(new java.awt.Dimension(78, 48));
        EnergyPanel.setName("EnergyPanel"); // NOI18N
        EnergyPanel.setOpaque(false);

        EnergyLabel.setText("Energie:");
        EnergyLabel.setName("EnergyLabel"); // NOI18N

        EnergyRecomendedLabel.setForeground(new java.awt.Color(153, 153, 153));
        EnergyRecomendedLabel.setName("EnergyRecomendedLabel"); // NOI18N

        javax.swing.GroupLayout EnergyPanelLayout = new javax.swing.GroupLayout(EnergyPanel);
        EnergyPanel.setLayout(EnergyPanelLayout);
        EnergyPanelLayout.setHorizontalGroup(
            EnergyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(EnergyLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
            .addComponent(EnergyRecomendedLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
        );
        EnergyPanelLayout.setVerticalGroup(
            EnergyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(EnergyPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(EnergyLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
                .addComponent(EnergyRecomendedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jSeparator1.setName("jSeparator1"); // NOI18N

        SummaryLabel.setFont(new java.awt.Font("Tahoma", 1, 14));
        SummaryLabel.setText("Celkem:");
        SummaryLabel.setFocusable(false);
        SummaryLabel.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        SummaryLabel.setName("SummaryLabel"); // NOI18N

        jSeparator2.setName("jSeparator2"); // NOI18N

        EnergyPanel1.setMaximumSize(new java.awt.Dimension(78, 48));
        EnergyPanel1.setMinimumSize(new java.awt.Dimension(78, 48));
        EnergyPanel1.setName("EnergyPanel1"); // NOI18N
        EnergyPanel1.setOpaque(false);
        EnergyPanel1.setPreferredSize(new java.awt.Dimension(78, 59));

        EnergyLabel1.setText("Energie:");
        EnergyLabel1.setName("EnergyLabel1"); // NOI18N

        EnergySummaryLabel.setName("EnergySummaryLabel"); // NOI18N

        javax.swing.GroupLayout EnergyPanel1Layout = new javax.swing.GroupLayout(EnergyPanel1);
        EnergyPanel1.setLayout(EnergyPanel1Layout);
        EnergyPanel1Layout.setHorizontalGroup(
            EnergyPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(EnergyLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
            .addComponent(EnergySummaryLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
        );
        EnergyPanel1Layout.setVerticalGroup(
            EnergyPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(EnergyPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(EnergyLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
                .addComponent(EnergySummaryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        BPanel1.setMaximumSize(new java.awt.Dimension(78, 48));
        BPanel1.setMinimumSize(new java.awt.Dimension(78, 48));
        BPanel1.setName("BPanel1"); // NOI18N
        BPanel1.setPreferredSize(new java.awt.Dimension(78, 59));

        BLabel1.setText("Bílkoviny:");
        BLabel1.setName("BLabel1"); // NOI18N

        BSummaryLabel.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        BSummaryLabel.setName("BSummaryLabel"); // NOI18N

        javax.swing.GroupLayout BPanel1Layout = new javax.swing.GroupLayout(BPanel1);
        BPanel1.setLayout(BPanel1Layout);
        BPanel1Layout.setHorizontalGroup(
            BPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(BPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(BSummaryLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE))
            .addComponent(BLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE)
        );
        BPanel1Layout.setVerticalGroup(
            BPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, BPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(BLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
                .addComponent(BSummaryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        ChPanel1.setMaximumSize(new java.awt.Dimension(78, 48));
        ChPanel1.setMinimumSize(new java.awt.Dimension(78, 48));
        ChPanel1.setName("ChPanel1"); // NOI18N
        ChPanel1.setPreferredSize(new java.awt.Dimension(78, 59));

        ChLabel1.setText("Cholesterol:");
        ChLabel1.setName("ChLabel1"); // NOI18N

        ChSummaryLabel.setName("ChSummaryLabel"); // NOI18N

        javax.swing.GroupLayout ChPanel1Layout = new javax.swing.GroupLayout(ChPanel1);
        ChPanel1.setLayout(ChPanel1Layout);
        ChPanel1Layout.setHorizontalGroup(
            ChPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ChPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ChLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addComponent(ChSummaryLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
        );
        ChPanel1Layout.setVerticalGroup(
            ChPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ChPanel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(ChLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(ChSummaryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(146, 146, 146))
        );

        SPanel1.setMaximumSize(new java.awt.Dimension(78, 48));
        SPanel1.setMinimumSize(new java.awt.Dimension(78, 48));
        SPanel1.setName("SPanel1"); // NOI18N
        SPanel1.setPreferredSize(new java.awt.Dimension(78, 48));

        SLabel1.setText("Sacharidy:");
        SLabel1.setName("SLabel1"); // NOI18N

        SSummaryLabel.setName("SSummaryLabel"); // NOI18N

        javax.swing.GroupLayout SPanel1Layout = new javax.swing.GroupLayout(SPanel1);
        SPanel1.setLayout(SPanel1Layout);
        SPanel1Layout.setHorizontalGroup(
            SPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, SPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(SSummaryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(SLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
        );
        SPanel1Layout.setVerticalGroup(
            SPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, SPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(SLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
                .addComponent(SSummaryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        TPanel1.setMaximumSize(new java.awt.Dimension(78, 48));
        TPanel1.setMinimumSize(new java.awt.Dimension(78, 48));
        TPanel1.setName("TPanel1"); // NOI18N
        TPanel1.setPreferredSize(new java.awt.Dimension(78, 59));

        TLabel1.setText("Tuky:");
        TLabel1.setName("TLabel1"); // NOI18N

        TSummaryLabel.setName("TSummaryLabel"); // NOI18N

        javax.swing.GroupLayout TPanel1Layout = new javax.swing.GroupLayout(TPanel1);
        TPanel1.setLayout(TPanel1Layout);
        TPanel1Layout.setHorizontalGroup(
            TPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, TPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(TSummaryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(TLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE)
        );
        TPanel1Layout.setVerticalGroup(
            TPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, TPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(TLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
                .addComponent(TSummaryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(EnergyPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(BPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(SPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(TPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ChPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(SummaryLabel)
                    .addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 382, Short.MAX_VALUE)
                    .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 382, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(EnergyPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(BPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(SPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(TPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ChPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(RecomendedLabel))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(SummaryLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(5, 5, 5)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(2, 2, 2)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(ChPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(EnergyPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(SPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(RecomendedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(3, 3, 3)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(2, 2, 2)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(ChPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(SPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE)
                    .addComponent(TPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE)
                    .addComponent(BPanel, javax.swing.GroupLayout.Alignment.LEADING, 0, 59, Short.MAX_VALUE)
                    .addComponent(EnergyPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(406, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents


public void setRecomendedData(double e, double b, double s, double t)
{
    this.Data[0][0] = e;
    this.Data[0][1] = b;
    this.Data[0][2] = s;
    this.Data[0][3] = t;

    this.Recount();
}

public void setSummaryData(double e, double b, double s, double t, double ch)
{
    this.Data[1][0] = e;
    this.Data[1][1] = b;
    this.Data[1][2] = s;
    this.Data[1][3] = t;
    this.Data[1][4] = ch;

    this.Recount();
}

public void Recount()
{

   this.EnergyRecomendedLabel.setValue(this.Data[0][0]);
   this.BRecomendedLabel.setValue(this.Data[0][1]);
   this.SRecomendedLabel.setValue(this.Data[0][2]);
   this.TRecomendedLabel.setValue(this.Data[0][3]);
   //this.ChSummaryLabel.setValue(this.Data[0][4]);
   this.EnergyRecomendedLabel.setToolTipText(Double.toString(this.Data[0][0]) + " KJ");
   this.BRecomendedLabel.setToolTipText(Double.toString(this.Data[0][1])  + " g");
   this.SRecomendedLabel.setToolTipText(Double.toString(this.Data[0][2])  + " g");
   this.TRecomendedLabel.setToolTipText(Double.toString(this.Data[0][3])  + " g");
   //this.ChSummaryLabel.setToolTipText(Double.toString(this.Data[0][4])  + " mg");

   this.EnergySummaryLabel.setValue(this.Data[1][0]);
   this.BSummaryLabel.setValue(this.Data[1][1]);
   this.SSummaryLabel.setValue(this.Data[1][2]);
   this.TSummaryLabel.setValue(this.Data[1][3]);
   this.ChSummaryLabel.setValue(this.Data[1][4]);
   this.EnergySummaryLabel.setToolTipText(Double.toString(this.Data[1][0]) + " KJ");
   this.BSummaryLabel.setToolTipText(Double.toString(this.Data[1][1])  + " g");
   this.SSummaryLabel.setToolTipText(Double.toString(this.Data[1][2])  + " g");
   this.TSummaryLabel.setToolTipText(Double.toString(this.Data[1][3])  + " g");
   this.ChSummaryLabel.setToolTipText(Double.toString(this.Data[1][4])  + " mg");

   if ((this.Data[0][0] - this.Data[1][0]) < 0.0) this.EnergySummaryLabel.setForeground(Color.RED); else this.EnergySummaryLabel.setForeground(this.DarkGreen);
   if ((this.Data[0][1] - this.Data[1][1]) < 0.0) this.BSummaryLabel.setForeground(Color.RED); else this.BSummaryLabel.setForeground(this.DarkGreen);
   if ((this.Data[0][2] - this.Data[1][2]) < 0.0) this.SSummaryLabel.setForeground(Color.RED); else this.SSummaryLabel.setForeground(this.DarkGreen);
   if ((this.Data[0][3] - this.Data[1][3]) < 0.0) this.TSummaryLabel.setForeground(Color.RED); else this.TSummaryLabel.setForeground(this.DarkGreen);
   if ((this.Data[0][4] - this.Data[1][4]) < 0.0) this.ChSummaryLabel.setForeground(this.DarkGreen); else this.ChSummaryLabel.setForeground(this.DarkGreen);

}

/**
 * Reaguje na udalost vyvolanou znenou tabu v MenuJtabbedPane.
 * @param e
 */
 public void stateChanged(ChangeEvent e){

    //if (e.getSource().getClass().getName().matches("MenuTabbedPane"))
    //{
    try
    {
    MenuTabbedPane pane = (MenuTabbedPane) e.getSource();
    MenuPanel panel = (MenuPanel) pane.getSelectedComponent();
    double [] SData = panel.getSummaryData();
    this.setSummaryData(SData[0], SData[1], SData[2], SData[3], SData[4]);
    }
    catch (NullPointerException ex) {}
    //}
}

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel BLabel;
    private javax.swing.JLabel BLabel1;
    private javax.swing.JPanel BPanel;
    private javax.swing.JPanel BPanel1;
    private jmenu.gui.ValueLabel BRecomendedLabel;
    private jmenu.gui.ValueLabel BSummaryLabel;
    private javax.swing.JLabel ChLabel;
    private javax.swing.JLabel ChLabel1;
    private javax.swing.JPanel ChPanel;
    private javax.swing.JPanel ChPanel1;
    private jmenu.gui.ValueLabel ChRecomendedLabel1;
    private jmenu.gui.ValueLabel ChSummaryLabel;
    private javax.swing.JLabel EnergyLabel;
    private javax.swing.JLabel EnergyLabel1;
    private javax.swing.JPanel EnergyPanel;
    private javax.swing.JPanel EnergyPanel1;
    private jmenu.gui.ValueLabel EnergyRecomendedLabel;
    private jmenu.gui.ValueLabel EnergySummaryLabel;
    private javax.swing.JLabel RecomendedLabel;
    private javax.swing.JLabel SLabel;
    private javax.swing.JLabel SLabel1;
    private javax.swing.JPanel SPanel;
    private javax.swing.JPanel SPanel1;
    private jmenu.gui.ValueLabel SRecomendedLabel;
    private jmenu.gui.ValueLabel SSummaryLabel;
    private javax.swing.JLabel SummaryLabel;
    private javax.swing.JLabel TLabel;
    private javax.swing.JLabel TLabel1;
    private javax.swing.JPanel TPanel;
    private javax.swing.JPanel TPanel1;
    private jmenu.gui.ValueLabel TRecomendedLabel;
    private jmenu.gui.ValueLabel TSummaryLabel;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    // End of variables declaration//GEN-END:variables

}
